﻿package plugin.platform
{
    import com.core.*;
    import flash.utils.*;
    import manager.*;
    import pluginfw.nio.*;
    import pluginfw.nio.imsg.*;

    public class PlatformHandler extends Object implements IGroupHandler
    {

        public function PlatformHandler()
        {
            return;
        }// end function

        public function dealSimpleMessage(param1:ISimpleMessage) : void
        {
            return;
        }// end function

        public function dealBufferMessage(param1:IBufferMessage) : void
        {
            var _loc_5:int = 0;
            var _loc_6:int = 0;
            var _loc_2:* = new Object();
            var _loc_3:* = new Input(null);
            var _loc_4:* = param1.getBody();
            param1.getBody().position = 0;
            _loc_3.setBytes(_loc_4);
            switch(param1.getCmd())
            {
                case CMDPlatform._2360SPEEDUPBALL:
                {
                    _loc_2.speedupBallReward = _loc_3.readVarInt(false);
                    ModelProxy.change("data", "speedUpBallState", _loc_2.speedupBallReward);
                    if (_loc_2.speedupBallReward == 1)
                    {
                        ModelProxy.change("mainui", "removeLeafBtn", "360jiasuqiu");
                        ModelProxy.change("mainui", "removeBtn", "360jiasuqiu");
                    }
                    break;
                }
                case CMDPlatform._4360ANTIVIRUS:
                {
                    _loc_5 = _loc_3.readShort();
                    _loc_2.levelGift = new Array();
                    _loc_6 = 0;
                    while (_loc_6 < _loc_5)
                    {
                        
                        _loc_2.levelGift[_loc_6] = _loc_3.readVarInt(false);
                        _loc_6++;
                    }
                    ModelProxy.change("data", "wslvgifti", _loc_2.levelGift);
                    ModelProxy.change("threehall", "update", null);
                    break;
                }
                case CMDPlatform._6360HALL:
                {
                    _loc_2.rewardState = _loc_3.readVarInt(false);
                    ModelProxy.change("data", "gameHallState", _loc_2.rewardState);
                    if (_loc_2.rewardState == 1)
                    {
                        ModelProxy.change("mainui", "removeBtn", "gameHallReward");
                        ModelProxy.change("gameHall", "listFly", null);
                    }
                    break;
                }
                case CMDPlatform._7360ANTIVIRUS:
                {
                    _loc_2.errorCode = _loc_3.readVarInt(false);
                    if (_loc_2.errorCode <= 0)
                    {
                        WarningManager.show(160 - int(_loc_2.errorCode));
                    }
                    break;
                }
                case CMDPlatform._8360ANTIVIRUS:
                {
                    _loc_2.dayGift = _loc_3.readVarInt(false);
                    _loc_2.dayExtraGift = _loc_3.readVarInt(false);
                    _loc_5 = _loc_3.readShort();
                    _loc_2.levelGift = new Array();
                    _loc_6 = 0;
                    while (_loc_6 < _loc_5)
                    {
                        
                        _loc_2.levelGift[_loc_6] = _loc_3.readVarInt(false);
                        _loc_6++;
                    }
                    ModelProxy.change("data", "vdayGift", _loc_2.dayGift);
                    ModelProxy.change("data", "vdayExtraGift", _loc_2.dayExtraGift);
                    ModelProxy.change("data", "vlevelGift", _loc_2.levelGift);
                    ModelProxy.change("vplan", "update", null);
                    break;
                }
                case CMDPlatform._9360ANTIVIRUS:
                {
                    _loc_2.state = _loc_3.readVarInt(false);
                    _loc_2.endTime = _loc_3.readVarInt(false);
                    ModelProxy.change("data", "vplanbuffer", _loc_2);
                    ModelProxy.change("bufferView", "addBindBuffer", "vplan");
                    break;
                }
                default:
                {
                    break;
                }
            }
            return;
        }// end function

        public function dealProxyMessage(param1:IProxyMessage) : void
        {
            return;
        }// end function

    }
}
